﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Xml.Serialization;

namespace LevelEditor.App.Serialization
{

    [Serializable]
    public class Box
    {
        private int width;
        [XmlElement("width")]
        public int Width
        {
            get { return width; }
            set { width = value; }
        }

        private int height;
        [XmlElement("height")]
        public int Height
        {
            get { return height; }
            set { height = value; }
        }

        private int x;
        [XmlElement("PositionX")]
        public int X
        {
            get { return x; }
            set { x = value; }
        }

        private int y;
        [XmlElement("PositionY")]
        public int Y
        {
            get { return y; }
            set { y = value; }
        }

        public Box()
        {

        }

        /// <summary>
        /// Same position in both x y. 
        /// Same side size
        /// </summary>
        /// <param name="pos">a position</param>
        /// <param name="l">a side size</param>
        public Box(int pos, int l)
        {
            this.x = this.y = pos;
            this.width = this.height = l;
        }

        /// <summary>
        /// Create a box
        /// </summary>
        /// <param name="x">a position x</param>
        /// <param name="y">a position y</param>
        /// <param name="width">an width</param>
        /// <param name="height">an height</param>
        public Box(int x, int y, int width, int height)
        {
            this.X = x;
            this.Y = y;
            this.width = width;
            this.height = height;
        }

        public Box(Point position, Size size)
        {
            this.x = position.X;
            this.y = position.Y;
            this.width = size.Width;
            this.height = size.Height;
        }
    }
}
